package com.example.qqfake;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.List;

public class Adapter3 extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
    private List<Chat_content> items;


    public Adapter3(List<Chat_content> items) {
        this.items = items;

    }


    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view;
        view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_recyclerview_right, parent, false);
        return new Recycler_item_right(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, @SuppressLint("RecyclerView") int position) {
        Chat_content item = items.get(position);
        ((Recycler_item_right) holder).bindData(item);

    }

    public void addItem(Chat_content rr){
        items.add(rr);
        notifyItemInserted(items.size() - 1);

    }


    @Override
    public int getItemCount() {
        return items.size();
    }



}


